import request from '@/utils/request'

/**
 * 登录接口
 * @param data
 * @returns {*}
 */
export const login = (data) => {
    return request({
        url: '/user/login',
        method: 'post',
        data: {
            username: data.username,
            password: data.password
        }
    })
}
/**
 * 获取所有商品
 * @returns {*}
 */
export const getAllProducts = () => {
    return request({
        url: '/products/getAllProducts',
        method: 'GET'


    })


}
/**
 * 获取所有分类
 * @returns {*}
 */
export const getAllCategories = () => {
    return request({
        url: '/products/getAllCategories',
        method: 'GET'
    })

}
/**
 * 获取所有品牌
 * @returns {*}
 */
export const getAllBrands = () => {
    return request({
        url: '/products/getAllBrands',
        method: 'GET'
    })

}
/**
 * 商品添加逻辑
 * @param data
 * @returns {*}
 */
export const addProduct = (data) => {

    return request({
        method: 'POST',
        url: '/products/addProduct',
        data: data

    })
}
/**
 * 更改商品逻辑
 * @param data
 * @returns {*}
 */
export const updateProduct = (data) => {
    return request({
        url: '/products/updateProduct',
        method: 'POST',
        data: data
    })
}
/**
 * 删除商品接口
 * @param data
 * @returns {*}
 */
export const deleteProduct = (data) => {
    return request({
        url: '/products/deleteProduct?id=' + data,
        method: 'POST'
    })
}
/**
 * 获取所有分类接口
 * @returns {*}
 */
export const getAllCategoriesInfo = () => {
    return request({
        url: '/products/getAllCategoriesInfo',
        method: 'GET'
    })
}
/**
 * 修改分类逻辑
 * @param data
 * @returns {*}
 */
export const updateCategory = (data) => {
    return request({
        url: '/products/updateCategory',
        method: 'post',
        data: data
    })
}
/**
 * 添加分类逻辑
 * @param data
 * @returns {*}
 */
export const addCategory = (data) => {
    return request({
        url: '/products/addCategory?name=' + data,
        method: 'POST'
    })
}
/**
 * 删除分类逻辑
 * @param data
 * @returns {*}
 */
export const deleteCategory = (data) => {
    return request({
        url: '/products/deleteCategory?id=' + data,
        method: 'POST'
    })
}
/**
 * 获取所有品牌详情信息
 */
export const getAllBrandsInfo = () => {
    return request({
        url: 'products/getAllBrandsInfo',
        method: 'GET'
    })


}
/**
 * 修改品牌逻辑
 * @param data
 * @returns {*}
 */
export const updateBrand = (data) => {
    return request({
        url: 'products/updateBrand',
        method: 'POST',
        data: data
    })

}
/**
 * 添加品牌逻辑
 * @param data
 * @returns {*}
 */
export const addBrand = (data) => {
    return request({
        url: 'products/addBrand?name=' + data,
        method: 'post'
    })


}
/**
 * 删除品牌逻辑
 */
export const deleteBrand = (data) => {
    return request({
        url: 'products/deleteBrand?id=' + data,
        method: 'POST'
    })

}
/**
 * 获取所有供应商信息
 */
export const getAllSuppliersInfo = () => {
    return request({
        url: 'suppliers/getAllSuppliers',
        method: 'GET'
    })

}
/**
 * 修改供货商信息
 */
export const updateSupplier = (data) => {
    return request({
        url: 'suppliers/changeSuppliers',
        method: 'post',
        data: data
    })
}
/**
 * 添加供货商信息
 */
export const addSupplier = (data) => {
    return request({
        url: 'suppliers/addSupplier',
        method: 'post',
        data: data
    })
}
/**
 * 删除供货商信息
 */
export const deleteSupplier = (data) => {
    return request({
        url: 'suppliers/deleteSupplier?id=' + data,
        method: 'post'
    })
}
/**
 * 获取所有入库信息
 */
export const getAllInbound = () => {
    return request({
        url: 'inbound/getAllInbound',
        method: 'GET'
    })
}
/**
 * 添加入库信息
 */
export const addInbound = (data) => {
    return request({
        url: 'inbound/addInbound',
        method: 'post',
        data: data
    })
}
/**
 * 修改入库信息
 */
export const updateInbound = (data) => {
    return request({
        url: 'inbound/updateInbound',
        method: 'post',
        data: data
    })
}
/**
 * 删除入库信息
 */
export const deleteInboundById = (data) => {
    return request({
        url: 'inbound/deleteInboundById?id=' + data,
        method: 'post'
    })
}
/**
 * 获取所有出库信息
 */
export const getAllOutBoundInfo = () => {
    return request({
        url: 'outbound/getAllOutbound',
        method: 'get'
    })
}
/**
 * 添加出库信息
 */
export const addOutbound = (data) => {
    return request({
        url: 'outbound/addOutbound',
        method: 'post',
        data: data
    })
}
/**
 * 更改库存信息
 */
export const updateOutbound = (data) => {
    return request({
        url: 'outbound/changeOutBound',
        method: 'post',
        data: data
    })
}
/**
 * 获取所有库存信息
 */
export const getAllStockInfo = () => {
    return request({
        url: 'stock/getAllStockInfo',
        method: 'get'
    })
}
/**
 * 修改安全库存信息
 */
export const changeSafetyStock = (data) => {
    return request({
        url: 'stock/changeSafetyStock',
        method: 'post',
        data: data
    })
}
/**
 * 获取所有拼成商品
 */
export const getAllFinishGoodS = () => {
    return request({
        url: 'finishProduct/getAllFinishProduct',
        method: 'get'
    })
}
/**
 * 添加成品商品
 */
export const addFinishGoods = (data) => {
    return request({
        url: 'finishProduct/insertFinishProduct',
        method: 'post',
        data: data
    })
}
/**
 * 修改成品信息
 */
export const updateFinishGoods = (data) => {
    return request({
        url: 'finishProduct/changeFinishProduct',
        method: 'post',
        data: data
    })
}
/**
 * 提交订单
 */
export const addOrders = (data) => {
    return request({
        url: 'orders/addOrders',
        method: 'post',
        data: data
    })
}
/**
 * 获取用户昵称
 */
export const getUserNickName = () => {
    return request({
        url: 'user/getNickname',
        method: 'get'
    })
}
/**
 * 获取所有订单信息
 */
export const  getAllOrdersInfo=()=>{
    return request({
        url:'orders/getAllOrdersInfo',
        method:'get'
    })
}
/**
 * 通过订单状态
 */
export const approveOrder=(data)=>{
    return request({
        url:'orders/approveOrder?id='+data,
        method:'post'
    })
}
/**
 * 拒绝订单
 */
export const refusedOrder=(data)=>{
    return request({
        url:'orders/refusedOrder?id='+data,
        method:'post'
    })
}
/**
 * 获取所有用户订单信息
 */
export const  getAllOrdersInfoByUser=()=>{
    return request({
        url:'orders/getAllOrdersInfoById',
        method:'get'
    })
}
